package edu.ufl.cise.cop5555.sp12.ast;

import edu.ufl.cise.cop5555.sp12.Kind;
import edu.ufl.cise.cop5555.sp12.TokenStream;
import edu.ufl.cise.cop5555.sp12.TokenStream.IllegalStringLiteralException;
import edu.ufl.cise.cop5555.sp12.TokenStream.Token;
import edu.ufl.cise.cop5555.sp12.context.ContextException;

public class SimpleType extends Type {
	
	public Kind type;
	
	public SimpleType(Kind type){
		this.type = type;
	}

	
	public Kind getKind()
	{
		return type;
		
	}
	public boolean isTypeValid()
	{
		if(type == Kind.INT || type == Kind.BOOLEAN || type == Kind.STRING)
		{
		return true;
		}
		else
		{
			//exception
		return false;
		}
		
	}
	@Override
	public Object visit(ASTVisitor v, Object arg) throws Exception {
		return v.visitSimpleType(this,arg);
	}
	
	@Override
	public boolean equals(Object o) {
		if (!(o instanceof SimpleType))
			return false;
		SimpleType other = (SimpleType) o;
		try {
			return type.equals(other.type);
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
		
	}

}
